<?php
namespace app\index\controller\train;
use app\common\controller\Frontend;
use think\Db;

class Indexeeee extends Frontend
{
    protected $layout = 'default';
    protected $noNeedLogin = [];
    protected $noNeedRight = ['*'];
    /**
     * 我的订单
     */
    public function index()
    {
        $param = $this->request->param();
        $w['t.uid'] = $this->auth->id;

        if(isset($param['status']) && $param['status'] != 22){
            $where['status'] = $param['status'];
        }else{
            $param['status'] = 22;
        }

        $list = Db::name("train_enroll t") ->join('train_article ar', 't.article_id=ar.id')->where($w)->field("ar.*")->select();
        $this->view->assign('param', $param);
        $this->view->assign('data', $list);
        $this->view->assign('title', '我的订单');
        $this->view->assign('u_type', 4);
        return $this->view->fetch();
    }
    /**
     * 站内信
     */
    public function mail(){
        $user_id=$this->auth->id;
        $mail_data = Db::name("mail")->where(['uid'=>$user_id])->select();
        $this->view->assign('data', $mail_data);
        $this->view->assign('title', '我的订单');
        $this->view->assign('u_type', 10);
        return $this->view->fetch();
    }
}
